package com.wei.czz.common.vo.common;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wei.czz.common.enums.CommonEnum;
import com.wei.czz.common.jsr303.group.OrderSearch;
import com.wei.czz.common.jsr303.group.Search;
import com.wei.czz.common.tool.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wei
 * date: 2021-05-14 11:29:00
 * className: BaseVo 公共Vo类
 * version: 1.0
 * description:
 */
@Getter
@Setter
public class BaseVo extends BaseEntity {

    /**
     * 查询-检索内容
     */
    protected String word;

    /**
     * 查询-状态
     */
    protected Integer status;

    /**
     * 查询-页码
     */
    @NotNull(message = "页码不能为空", groups = { Search.class, OrderSearch.class })
    @Range(message = "页码不能超于500页", max = 500, groups = { Search.class, OrderSearch.class })
    protected Integer page;

    /**
     * 查询-一页显示数据个数
     */
    @NotNull(message = "每页大小不能为空", groups = { Search.class, OrderSearch.class })
    @Range(message = "每页大小不能超于1000", max = 1000, groups = { Search.class, OrderSearch.class })
    protected Integer limit;

    /**
     * 数据排序字段
     */
    @NotNull(message = "排序字段不能为空", groups = { OrderSearch.class })
    protected String field;

    /**
     * 数据排序方式[ascending-升序 descending-降序]
     */
    @NotNull(message = "排序方式不能为空", groups = { OrderSearch.class })
    protected String order;

    /**
     * 删除状态[0-正常 1-删除]
     */
    @JsonIgnore
    @JSONField(serialize = false)
    protected Integer deleteStatus = CommonEnum.ZERO.getValue();

}
